import 'package:ai_model/generated/json/base/json_convert_content.dart';
import 'package:ai_model/app/core/network/data/api_do_login_by_s_m_s_captcha_entity.dart';

ApiDoLoginBySMSCaptchaEntity $ApiDoLoginBySMSCaptchaEntityFromJson(
    Map<String, dynamic> json) {
  final ApiDoLoginBySMSCaptchaEntity apiDoLoginBySMSCaptchaEntity = ApiDoLoginBySMSCaptchaEntity();
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    apiDoLoginBySMSCaptchaEntity.code = code;
  }
  final String? message = jsonConvert.convert<String>(json['message']);
  if (message != null) {
    apiDoLoginBySMSCaptchaEntity.message = message;
  }
  final UserInfoAndTokenData? data = jsonConvert.convert<UserInfoAndTokenData>(
      json['data']);
  if (data != null) {
    apiDoLoginBySMSCaptchaEntity.data = data;
  }
  return apiDoLoginBySMSCaptchaEntity;
}

Map<String, dynamic> $ApiDoLoginBySMSCaptchaEntityToJson(
    ApiDoLoginBySMSCaptchaEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['message'] = entity.message;
  data['data'] = entity.data?.toJson();
  return data;
}

extension ApiDoLoginBySMSCaptchaEntityExtension on ApiDoLoginBySMSCaptchaEntity {
  ApiDoLoginBySMSCaptchaEntity copyWith({
    String? code,
    String? message,
    UserInfoAndTokenData? data,
  }) {
    return ApiDoLoginBySMSCaptchaEntity()
      ..code = code ?? this.code
      ..message = message ?? this.message
      ..data = data ?? this.data;
  }
}

UserInfoAndTokenData $UserInfoAndTokenDataFromJson(Map<String, dynamic> json) {
  final UserInfoAndTokenData userInfoAndTokenData = UserInfoAndTokenData();
  final UserInfo? userInfo = jsonConvert.convert<UserInfo>(json['userInfo']);
  if (userInfo != null) {
    userInfoAndTokenData.userInfo = userInfo;
  }
  final String? token = jsonConvert.convert<String>(json['token']);
  if (token != null) {
    userInfoAndTokenData.token = token;
  }
  return userInfoAndTokenData;
}

Map<String, dynamic> $UserInfoAndTokenDataToJson(UserInfoAndTokenData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['userInfo'] = entity.userInfo?.toJson();
  data['token'] = entity.token;
  return data;
}

extension UserInfoAndTokenDataExtension on UserInfoAndTokenData {
  UserInfoAndTokenData copyWith({
    UserInfo? userInfo,
    String? token,
  }) {
    return UserInfoAndTokenData()
      ..userInfo = userInfo ?? this.userInfo
      ..token = token ?? this.token;
  }
}

UserInfo $UserInfoFromJson(Map<String, dynamic> json) {
  final UserInfo userInfo = UserInfo();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    userInfo.id = id;
  }
  final String? userCode = jsonConvert.convert<String>(json['userCode']);
  if (userCode != null) {
    userInfo.userCode = userCode;
  }
  final String? userName = jsonConvert.convert<String>(json['userName']);
  if (userName != null) {
    userInfo.userName = userName;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    userInfo.status = status;
  }
  final String? statusName = jsonConvert.convert<String>(json['statusName']);
  if (statusName != null) {
    userInfo.statusName = statusName;
  }
  final int? createDate = jsonConvert.convert<int>(json['createDate']);
  if (createDate != null) {
    userInfo.createDate = createDate;
  }
  final String? createDateStr = jsonConvert.convert<String>(
      json['createDateStr']);
  if (createDateStr != null) {
    userInfo.createDateStr = createDateStr;
  }
  final String? createPerson = jsonConvert.convert<String>(
      json['createPerson']);
  if (createPerson != null) {
    userInfo.createPerson = createPerson;
  }
  final int? updateDate = jsonConvert.convert<int>(json['updateDate']);
  if (updateDate != null) {
    userInfo.updateDate = updateDate;
  }
  final String? updateDateStr = jsonConvert.convert<String>(
      json['updateDateStr']);
  if (updateDateStr != null) {
    userInfo.updateDateStr = updateDateStr;
  }
  final String? updatePerson = jsonConvert.convert<String>(
      json['updatePerson']);
  if (updatePerson != null) {
    userInfo.updatePerson = updatePerson;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    userInfo.remark = remark;
  }
  final String? headImg = jsonConvert.convert<String>(json['headImg']);
  if (headImg != null) {
    userInfo.headImg = headImg;
  }
  final String? loginName = jsonConvert.convert<String>(json['loginName']);
  if (loginName != null) {
    userInfo.loginName = loginName;
  }
  final String? phoneNumber = jsonConvert.convert<String>(json['phoneNumber']);
  if (phoneNumber != null) {
    userInfo.phoneNumber = phoneNumber;
  }
  final dynamic attrMap = json['attrMap'];
  if (attrMap != null) {
    userInfo.attrMap = attrMap;
  }
  return userInfo;
}

Map<String, dynamic> $UserInfoToJson(UserInfo entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['userCode'] = entity.userCode;
  data['userName'] = entity.userName;
  data['status'] = entity.status;
  data['statusName'] = entity.statusName;
  data['createDate'] = entity.createDate;
  data['createDateStr'] = entity.createDateStr;
  data['createPerson'] = entity.createPerson;
  data['updateDate'] = entity.updateDate;
  data['updateDateStr'] = entity.updateDateStr;
  data['updatePerson'] = entity.updatePerson;
  data['remark'] = entity.remark;
  data['headImg'] = entity.headImg;
  data['loginName'] = entity.loginName;
  data['phoneNumber'] = entity.phoneNumber;
  data['attrMap'] = entity.attrMap;
  return data;
}

extension UserInfoExtension on UserInfo {
  UserInfo copyWith({
    int? id,
    String? userCode,
    String? userName,
    String? status,
    String? statusName,
    int? createDate,
    String? createDateStr,
    String? createPerson,
    int? updateDate,
    String? updateDateStr,
    String? updatePerson,
    String? remark,
    String? headImg,
    String? loginName,
    String? phoneNumber,
    dynamic attrMap,
  }) {
    return UserInfo()
      ..id = id ?? this.id
      ..userCode = userCode ?? this.userCode
      ..userName = userName ?? this.userName
      ..status = status ?? this.status
      ..statusName = statusName ?? this.statusName
      ..createDate = createDate ?? this.createDate
      ..createDateStr = createDateStr ?? this.createDateStr
      ..createPerson = createPerson ?? this.createPerson
      ..updateDate = updateDate ?? this.updateDate
      ..updateDateStr = updateDateStr ?? this.updateDateStr
      ..updatePerson = updatePerson ?? this.updatePerson
      ..remark = remark ?? this.remark
      ..headImg = headImg ?? this.headImg
      ..loginName = loginName ?? this.loginName
      ..phoneNumber = phoneNumber ?? this.phoneNumber
      ..attrMap = attrMap ?? this.attrMap;
  }
}